<?php

Class Conexao {

    protected $con = NULL;

    function __construct($strConexao) {
        $this->con = pg_connect($strConexao);
    }

    function executa($query) {
        pg_query($this->con, $query);
    }

    function consulta($query) {
        $res = pg_query($this->con, $query);
        $resultado = array();
        while ($r = pg_fetch_object($res)) {
            $resultado[] = $r;
        }
        return $resultado;
    }

}

?>